package com.example.scheduled;

import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * @program: demo
 * @description: schedule  demo类
 * @author: Mr.Wang
 * @create: 2019-03-27 13:37
 **/
@Service
@EnableScheduling
public class PrintTaskCron {


    //@Scheduled(cron = "*/5 * * * * ?")
/*    @Scheduled(fixedDelay = 5000)
@Async
    public void CronB() throws Exception{
        System.out.println("B 执行一次时间:"+new Date(System.currentTimeMillis()));
        Thread.sleep(10000);
        System.out.println("C 执行一次时间:"+new Date(System.currentTimeMillis()));
    }*/

//    @Scheduled(cron = "*/5 * * * * ?")
//    @Async
//    public void cronA() throws Exception{
//        System.out.println("A 执行一次时间:"+new Date(System.currentTimeMillis()));
//    }

}
